package com.example.reactor.r2dbc.db.factory;

import com.example.reactor.r2dbc.db.Customer;
import lombok.AllArgsConstructor;
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
import reactor.core.publisher.Flux;

/**
 * @author zpMeng
 * @since 6/16/2025
 */
@AllArgsConstructor
public class DynamicRepoImpl {
    private final R2dbcEntityTemplate template;
    private final String tableName;

    public Flux<Customer> findAll() {
        return template.select(Customer.class).from(tableName).all();
    }
}
